package com.ftg.learn.chapter11;

import java.util.Arrays;

public class Demo02 {
    public void yi(int[][] arr){
        //赋值遍历输出
        for(int i = 0;i<arr.length;i++){
            for(int j = 0;j<arr[i].length;j++){
                arr[i][j] = i+j;
                System.out.print(arr[i][j]+"\t");
            }
            System.out.println();
        }        System.out.println("++++++++++++++++++++++++++");
        //蛇形打印
        for(int i = 0;i<arr.length;i++){
            for(int j = 0;j<arr[i].length;j++){
                System.out.print(i%2==0?arr[i][j]+"\t":arr[i][arr[i].length-j-1]+"\t");
            }
            System.out.println();
        }

    }
//11111111111111111111111111111111111111111111111
    public void testIntArr(){
        int[] arr = new int[]{1,2,3,4,5,6,7,8};

        int[] at = Arrays.copyOf(arr,10);
        for (int i : at){
            System.out.println(i);
        }
    }


    public void arrayHelp(){
        int[] as = new int[]{1,2,4,5,6,7,9};
        //@since 1.6
        int a = Arrays.binarySearch(as,2,6,3);
        System.out.println(a);
    }

    public void test(){
        for(int i =1;i<=11;i++){
            if(i<7){
                System.out.print(i+"\t");
            }else{
                System.out.print(12-i+"\t");
            }
        }
    }
}
